<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('供应商管理')" />

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">名称</label>
                        <input type="text" class="layui-input" name="mc" id="mc" placeholder="请输入供应商名称" />

                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">编号</label>
                        <input type="text" class="layui-input" name="bh" id="bh" placeholder="请输入编号" />
                    </div>
                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal search_btn" lay-event="searchEvent" data-type="reload">查询</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-normal">重置</button>
                    </div>
                </form>
            <!--顶部按钮展示区域 【 tpl-button 】 -->
            <div class="group-button tpl-button" id="toolbar"></div>
            <!--列表-->
            <section class="panel panel-padding layui-card-body">
                <div class="pro">
                    <table id="table" class="table text-nowrap"></table>
                </div>
            </section>
        </div>
    </div>
    </div>
</div>

</body>


<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">
</style>
<script th:inline="javascript">
    var functions = [[${functions}]];
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate', 'tablebutton'], function () {
        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate,
            tablebtn = layui.tablebutton;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function(){
                    zzpUtils.refreshTable("#table");
                },
                /*新增*/
                addEvent: function (data) {
                    add();
                },
            }
        });
        //初始化
        zzpUtils.webSocket.init();
        //新增
        function add() {
            zzpUtils.dialog({
                title: "新增供应商",
                type: 2,
                content: "/supplier/addsupplier",
                area: ['60%', '90%'], //设置dialog大小，也可以不设置，
                end: function () {//增加成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }
        laydate.render({
            elem: '#test5'
            ,theme: '#20a0ff'
        })
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination:true,
            url: '/wmsownersupplier/list',
            columns: [ {
                field: 'sshzname',
                title: '货主名称'
            },{
                field: 'mc',
                title: '供应商名称'
            },{
                field: 'bh',
                title: '供应商编号'
            },{
                field: 'sheng',
                title: '省',
            },{
                field: 'cs',
                title: '城市'
            },{
                field: 'lxr',
                title: '联系人'
            },{
                field: 'yb',
                title: '邮编'
            },{
                field: 'xxdz',
                title: '详细地址',
                visible: false
            },{
                field: 'gj',
                title: '国家',
                visible: false
            },{
                field: 'dh1',
                title: '电话1',
                visible: false
            },{
                field: 'dh2',
                title: '电话2',
                visible: false
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (index, row) {
                return "这里就没有确定过11";
            },

        });
    });
</script>
</html>